package com.git.contractmanagement.mapper;


import com.git.contractmanagement.entity.Orders;
import com.git.contractmanagement.entity.dto.GoodsSalesDTO;
import com.git.contractmanagement.entity.dto.OrdersPageQueryDTO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper {




    void insertBatch(Orders orders);

    @Select("select * from orders where id = #{orderId}")
    Orders getOrder(Long orderId);

    @Update("update orders set status = #{status} where id = #{orderId}")
    void updateStatus( Integer status ,Long orderId);


    Page<Orders> pageQuery(OrdersPageQueryDTO ordersPageQueryDTO);


    Double sumByMap(Map map);


    Integer countByMap(Map map);


    List<GoodsSalesDTO> getSalesTop10(LocalDateTime beginTime, LocalDateTime endTime);


    @Select("select * from orders where id = #{orderId}")
    Orders getByNumberAndUserId(Long orderId);


    void update(Orders orders);


}
